package com.lyc.campuslife.service.impl;

import com.lyc.campuslife.dto.Result;
import com.lyc.campuslife.entity.SeckillVoucher;
import com.lyc.campuslife.entity.Voucher;
import com.lyc.campuslife.mapper.VoucherMapper;
import com.lyc.campuslife.service.ISeckillVoucherService;
import com.lyc.campuslife.service.IVoucherService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

import java.util.List;

import static com.lyc.campuslife.utils.RedisConstants.SECKILL_STOCK_KEY;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lyc
 * @since 2024-05-07
 */
@Service
public class VoucherServiceImpl extends ServiceImpl<VoucherMapper, Voucher> implements IVoucherService {
    @Resource
    private ISeckillVoucherService seckillVoucherService;
    @Resource
    private StringRedisTemplate stringRedisTemplate;


    @Override
    public Result queryVoucherOfShop(Long shopId) {
        // 查询优惠券信息
        List<Voucher> vouchers = getBaseMapper().queryVoucherOfShop(shopId);
        System.out.println(vouchers);
        // 返回结果
        return Result.ok(vouchers);
    }
}
